﻿using Super_Wall_Breaker.Sources.GameElements.Bats;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace Super_Wall_Breaker.Sources.TeamElements.Players
{
    /// <summary>
    /// This class represents a player. It's abstract because the Update method depends on the type of the player.
    /// (AI or Real player).
    /// </summary>
    public abstract class Player
    {
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////// ATTRIBUTS & PROPRIETES //////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        protected TeamIndex _teamIndex;

        protected Bat _bat;
        protected Vector2 _initialBatSpeed;

        /// <summary>
        /// The bat of the player.
        /// </summary>
        public Bat Bat
        {
            get { return this._bat; }
            set { this._bat = value; }
        }

        /// <summary>
        /// This constructor makes a Player.
        /// It's call by subclasses.
        /// </summary>
        /// <param name="teamIndex"> The index of the player.</param>
        /// <param name="position">The bat position of the player.</param>
        /// <param name="speed">The speed of the bat.</param>
        /// <param name="sourceRectangle">The source rectangle used to select the texture to display in the spritesheet.</param>
        public Player(TeamIndex teamIndex, Vector2 position, Vector2 speed,Rectangle? sourceRectangle)
        {
            this._teamIndex = teamIndex;
            this._bat = new Bat(position, speed,sourceRectangle);
            this._initialBatSpeed = speed;
        }

        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////// METHODES //////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method update the Player logical.
        /// </summary>
        /// <param name="gameTime"></param>
        public abstract void Update(GameTime gameTime);
    }
}
